package ar.com.temporis.fixture.system;

import java.util.ArrayList;

import ar.com.temporis.fixture.SimpleFixture;
import ar.com.temporis.system.domain.Foo;
import ar.com.temporis.system.domain.User;

public class FooFixture extends SimpleFixture {

	@Override
	protected void addEntities() {
		add(createFoo("foo1", createSomeObject()));
		add(createFoo("foo2", null));
	}

	private Object createSomeObject() {
		ArrayList<User> list = new ArrayList<User>();

		list.add(createUser("name1", "password1", "nick1"));
		list.add(createUser("name2", "password2", "nick2"));

		return list;
	}

	private User createUser(String username, String password, String nick) {
		User user = new User();

		user.setUsername(username);
		user.setPassword(password);
		user.setNick(nick);

		return user;
	}

	private Foo createFoo(String name, Object object) {
		Foo foo = new Foo();

		foo.setName(name);
		foo.setObject(object);

		return foo;
	}

}
